// pages/myHistory/myHistory.js
const App = getApp()
Page({
  data: {
    list: [],
    moreData: false,
    params: {
      pageSize: 10,
      pageNum: 1,
    }
  },
  onLoad(options) {
    this.getHistory()
  },
  async getHistory() {
    let data = await App.$axios.request({
      url: `/parent/user/registerHistory`,
      method: 'GET',
      loading: true,
      data: {
        ...this.data.params
      }
    })
    if (data && data.rows) {
      this.setData({
        params: {
          ...this.data.params,
          pageNum: data.pageNum + 1
        },
        list: [...this.data.list, ...data.rows],
        moreData: data.total > data.pageNum * 10
      })
    }
  }
})